package com.example.filelock.utils;

import android.content.Context;
import android.util.Log;
import android.widget.Toast;

import com.android.volley.Request;
import com.android.volley.RequestQueue;
import com.android.volley.Response;
import com.android.volley.VolleyError;
import com.android.volley.toolbox.JsonObjectRequest;
import com.android.volley.toolbox.Volley;

import org.json.JSONObject;

public class MyHttp {
    public static void post(String path, final Context context, Response.Listener<JSONObject> res) {
        RequestQueue queue = Volley.newRequestQueue(context);
        queue.add(new JsonObjectRequest(Request.Method.GET, path, res, new Response.ErrorListener() {
            @Override
            public void onErrorResponse(VolleyError volleyError) {
                Log.d(BasDataUtil.LOG_TOAST, "Myhttp提示:----" + volleyError.toString());
                Toast.makeText(context, "访问服务器错误", Toast.LENGTH_SHORT).show();
            }
        }));
    }
}
